<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page import="eu.bitwalker.useragentutils.*" %>
<%
    // 获取 User-Agent 字符串
    String userAgentString = request.getHeader("User-Agent");

    // 解析 User-Agent 字符串
    UserAgent userAgent = UserAgent.parseUserAgentString(userAgentString);
    OperatingSystem os = userAgent.getOperatingSystem();

    // 判断设备类型并设置跳转URL
    String redirectUrl;
    if (os.isMobileDevice()) {
        redirectUrl = "mobilePage.jsp"; // 移动设备页面
    } else {
        redirectUrl = "desktopPage.jsp"; // 桌面设备页面
    }

    // 重定向到相应的页面
    response.sendRedirect(redirectUrl);
%>
